import java.util.Iterator;
import java.util.LinkedList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2022-11-11
 * Time: 10:07
 */
public class Test {
    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("ab");
        linkedList.add("ac");
        linkedList.add("ad");
        Iterator it = linkedList.iterator();
        while (it.hasNext()){
            Object obj = it.next();
            if("ab".equals(obj)){
                it.remove();
            }else {
                System.out.print(obj.toString().toUpperCase()+" ");
            }
        }
    }
}
